#ifndef RANDOM_HPP
#define RANDOM_HPP
#include <fstream>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <boost/random/variate_generator.hpp>
#include <armadillo>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/exponential_distribution.hpp>

namespace RandomG{
	
using namespace std;
using namespace arma;
using namespace boost::random;

int getSeed()
{
    ifstream rand("/dev/urandom");
    char tmp[sizeof(int)];
    rand.read(tmp,sizeof(int));
    rand.close();
    int* number = reinterpret_cast<int*>(tmp);
    return (*number);
}

template<class distribution>
class Random 
{
	public:
	Random(distribution nd)
	{
		mt19937 randgen(getSeed());
		rng=new variate_generator<mt19937,distribution >(randgen, nd);	
	}
	Random<distribution>& operator=(const Random<distribution>& X)
	{
		rng=X.rng;
	}
	virtual ~Random()
	{
		delete rng;
	}
	double operator()(void)
	{
		return (*rng)();
	}
	variate_generator<mt19937,distribution > *rng;
};



}
#endif

